package com.kycq.viewpager.fragment.state;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.kycq.viewpager.fragment.Fragment1;
import com.kycq.viewpager.fragment.Fragment2;
import com.kycq.viewpager.fragment.Fragment3;
import com.kycq.viewpager.fragment.Fragment4;
import com.kycq.viewpager.fragment.Fragment5;

public class StatePagerAdapter extends FragmentStatePagerAdapter {

	public StatePagerAdapter(FragmentManager fm) {
		super(fm);
	}

	@Override
	public Fragment getItem(int position) {
		switch (position) {
			case 0:
				return new Fragment1();
			case 1:
				return new Fragment2();
			case 2:
				return new Fragment3();
			case 3:
				return new Fragment4();
			case 4:
				return new Fragment5();
		}
		return null;
	}

	@Override
	public int getCount() {
		return 5;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return String.valueOf(position + 1);
	}
}
